package cn.qy.kotlin.base

/**
 * 对象与类
 */

// 一个最简单的类
class Customer

class Contact(val id: Int, var email: String)

open class Tiger(val origin: String) {
    fun sayHello() {
        println("A tiger from $origin says: grrhhh!")
    }
}

class SiberianTiger : Tiger("Siberia")

open class Lion(val name: String, val origin: String) {
    fun sayHello() {
        println("$name, the lion from $origin says: graoh!")
    }
}

class Asiatic(name: String) : Lion(name = name, origin = "India")

fun main() {
    val customer = Customer()
    val contact = Contact(1, "zhang@qq.com")
    println(contact.id)
    contact.email = "jane@gmail.com"

    val tiger: Tiger = SiberianTiger()
    tiger.sayHello()

    val lion: Lion = Asiatic("Rufo")
    lion.sayHello()
}


